\hypertarget{class_robot_controller}{
\section{RobotController Class Reference}
\label{class_robot_controller}\index{RobotController@{RobotController}}
}


{\ttfamily \#include $<$RobotController.hpp$>$}

Inheritance diagram for RobotController:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=7.368421cm]{class_robot_controller}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_robot_controller_a1b3379c8c3350b2130f30c8bd23cba33}{RobotController} ()
\item 
virtual \hyperlink{class_robot_controller_a4441cd6adf323a0ce3c454dc4f02efaf}{$\sim$RobotController} ()
\item 
bool \hyperlink{class_robot_controller_affcac419df7037300e17c3a2de6c6280}{GetIsActive} () const 
\item 
void \hyperlink{class_robot_controller_a1ca925b13cc1c5da27604363fde4308f}{Activate} ()
\item 
void \hyperlink{class_robot_controller_a49bb028954139831be2fa6bc32ca342a}{Deactivate} ()
\end{DoxyCompactItemize}
\subsection*{Protected Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_systematic_robot}{SystematicRobot} $\ast$ \hyperlink{class_robot_controller_ac4d2d8fd3e5a0e6cc20fd812f50babc9}{GetRobot} ()
\item 
\hyperlink{class_robot_controller}{RobotController} \& \hyperlink{class_robot_controller_ac5cacb19f197f4dafbff3319e9669b59}{AddSubcontroller} (\hyperlink{class_robot_controller}{RobotController} \&controller)
\item 
virtual void \hyperlink{class_robot_controller_aab89514f2e703d76074c4f5dcea1bf65}{HandleActivate} ()
\item 
virtual void \hyperlink{class_robot_controller_aabb392f33363102fb82005e373450bc7}{HandleDeactivate} ()
\item 
virtual void \hyperlink{class_robot_controller_af4db95564f7fd78241be8baff2296e26}{HandlePeriodic} ()
\item 
virtual void \hyperlink{class_robot_controller_a0b1874a782c9500768cb5e740ed57b6e}{HandleContinuous} ()
\item 
virtual void \hyperlink{class_robot_controller_a44fdc7736b45b3801bdd650c2e4487cc}{HandleAddedToRobot} (\hyperlink{class_systematic_robot}{SystematicRobot} \&robot)
\item 
{\footnotesize template$<$typename T $>$ }\\T \& \hyperlink{class_robot_controller_a257ad879c96bf010624c25c91d209b11}{RequireControl} (T \&obj)
\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_robot_controller_af45e8a01b72511d7dc39a93fdbeada29}{
class \hyperlink{class_robot_controller_af45e8a01b72511d7dc39a93fdbeada29}{SystematicRobot}}
\label{class_robot_controller_af45e8a01b72511d7dc39a93fdbeada29}

\item 
\hypertarget{class_robot_controller_af91074984dc8ac8d151925b357484137}{
class \hyperlink{class_robot_controller_af91074984dc8ac8d151925b357484137}{CompoundController}}
\label{class_robot_controller_af91074984dc8ac8d151925b357484137}

\item 
\hypertarget{class_robot_controller_a51513aeb7810ced3badc7064adfc7d9d}{
class \hyperlink{class_robot_controller_a51513aeb7810ced3badc7064adfc7d9d}{StateMachineController}}
\label{class_robot_controller_a51513aeb7810ced3badc7064adfc7d9d}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
The \hyperlink{class_robot_controller}{RobotController} class controls robot subsystems and other robot controllers.

A controller represents a slightly broad will to do something. (e.g. A DriverController would represent the will to drive the robot.)

To use it, create subclasses that override HandleActivate, HandleDeactivate, HandlePeriodic, and HandleContinuous. Remember that they will only run if they have been activated by the Activate function.

All controllers must be added to the Systematic robot. Teleop and autonomous controllers should be created and added with their respective set functions. They will be activated at the correct time, and can activate other controllers as needed.

Controllers other than autonomous and teleop must be activated and deactivated by these two main controllers.

Testing shows this class works. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_robot_controller_a1b3379c8c3350b2130f30c8bd23cba33}{
\index{RobotController@{RobotController}!RobotController@{RobotController}}
\index{RobotController@{RobotController}!RobotController@{RobotController}}
\subsubsection[{RobotController}]{\setlength{\rightskip}{0pt plus 5cm}RobotController::RobotController (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_robot_controller_a1b3379c8c3350b2130f30c8bd23cba33}
Constructor for \hyperlink{class_robot_controller}{RobotController}. \hypertarget{class_robot_controller_a4441cd6adf323a0ce3c454dc4f02efaf}{
\index{RobotController@{RobotController}!$\sim$RobotController@{$\sim$RobotController}}
\index{$\sim$RobotController@{$\sim$RobotController}!RobotController@{RobotController}}
\subsubsection[{$\sim$RobotController}]{\setlength{\rightskip}{0pt plus 5cm}RobotController::$\sim$RobotController (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}virtual\mbox{]}}}}
\label{class_robot_controller_a4441cd6adf323a0ce3c454dc4f02efaf}
Destructor for \hyperlink{class_robot_controller}{RobotController}. 

\subsection{Member Function Documentation}
\hypertarget{class_robot_controller_a1ca925b13cc1c5da27604363fde4308f}{
\index{RobotController@{RobotController}!Activate@{Activate}}
\index{Activate@{Activate}!RobotController@{RobotController}}
\subsubsection[{Activate}]{\setlength{\rightskip}{0pt plus 5cm}void RobotController::Activate (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_robot_controller_a1ca925b13cc1c5da27604363fde4308f}
Activates the controller. \hypertarget{class_robot_controller_ac5cacb19f197f4dafbff3319e9669b59}{
\index{RobotController@{RobotController}!AddSubcontroller@{AddSubcontroller}}
\index{AddSubcontroller@{AddSubcontroller}!RobotController@{RobotController}}
\subsubsection[{AddSubcontroller}]{\setlength{\rightskip}{0pt plus 5cm}{\bf RobotController} \& RobotController::AddSubcontroller (
\begin{DoxyParamCaption}
\item[{{\bf RobotController} \&}]{controller}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_robot_controller_ac5cacb19f197f4dafbff3319e9669b59}
Add a subcontroller to the controller.

This is necessary for two reasons. 1. So subcontroller get added to the robot automatically. 2. So this controller and one subcontroller can share a control lock on the same object (such as a \hyperlink{class_robot_subsystem}{RobotSubsystem}).


\begin{DoxyParams}{Parameters}
{\em controller} & The \hyperlink{class_robot_controller}{RobotController} to add as a subcontroller.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The controller parameter. 
\end{DoxyReturn}
\hypertarget{class_robot_controller_a49bb028954139831be2fa6bc32ca342a}{
\index{RobotController@{RobotController}!Deactivate@{Deactivate}}
\index{Deactivate@{Deactivate}!RobotController@{RobotController}}
\subsubsection[{Deactivate}]{\setlength{\rightskip}{0pt plus 5cm}void RobotController::Deactivate (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_robot_controller_a49bb028954139831be2fa6bc32ca342a}
Deactivates the controller. \hypertarget{class_robot_controller_affcac419df7037300e17c3a2de6c6280}{
\index{RobotController@{RobotController}!GetIsActive@{GetIsActive}}
\index{GetIsActive@{GetIsActive}!RobotController@{RobotController}}
\subsubsection[{GetIsActive}]{\setlength{\rightskip}{0pt plus 5cm}bool RobotController::GetIsActive (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const}}
\label{class_robot_controller_affcac419df7037300e17c3a2de6c6280}
Get whether the controller is active.

\begin{DoxyReturn}{Returns}
Whether the controller is active. 
\end{DoxyReturn}
\hypertarget{class_robot_controller_ac4d2d8fd3e5a0e6cc20fd812f50babc9}{
\index{RobotController@{RobotController}!GetRobot@{GetRobot}}
\index{GetRobot@{GetRobot}!RobotController@{RobotController}}
\subsubsection[{GetRobot}]{\setlength{\rightskip}{0pt plus 5cm}{\bf SystematicRobot} $\ast$ RobotController::GetRobot (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}protected\mbox{]}}}}
\label{class_robot_controller_ac4d2d8fd3e5a0e6cc20fd812f50babc9}
Get the robot that this controller is currently a part of.

\begin{DoxyReturn}{Returns}
A pointer to the robot if part of a robot. Otherwise NULL. 
\end{DoxyReturn}
\hypertarget{class_robot_controller_aab89514f2e703d76074c4f5dcea1bf65}{
\index{RobotController@{RobotController}!HandleActivate@{HandleActivate}}
\index{HandleActivate@{HandleActivate}!RobotController@{RobotController}}
\subsubsection[{HandleActivate}]{\setlength{\rightskip}{0pt plus 5cm}void RobotController::HandleActivate (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}protected, virtual\mbox{]}}}}
\label{class_robot_controller_aab89514f2e703d76074c4f5dcea1bf65}
This function should be overridden to activate the controller. 

Reimplemented in \hyperlink{class_chain_state_a3be88e1f294b5f958a69a17eea7cc941}{ChainState}, \hyperlink{class_compound_controller_a78f4f61a044c763e2974943506780835}{CompoundController}, \hyperlink{class_digital_input_check_state_ab91a5c594a247e2544759560ed0f64cc}{DigitalInputCheckState}, \hyperlink{class_instant_state_a054dbdbc513552eacab938c0245e22fa}{InstantState}, \hyperlink{class_mecanum_drive_subsystem_1_1_drive_start_state_a84daeab03132061b1b7acbc58d2ca2a8}{MecanumDriveSubsystem::DriveStartState}, \hyperlink{class_selector_controller_a053f47a303da4becb263bdb78f24965c}{SelectorController$<$ Item $>$}, \hyperlink{class_state_a3a160d410512e0f4529210aa8e1d9117}{State}, \hyperlink{class_state_machine_controller_aa0fafc4547691b82d7045bbe25bdcf7c}{StateMachineController}, \hyperlink{class_time_wait_state_aa42ceb5a951505135ac8e88b2260c30f}{TimeWaitState}, and \hyperlink{class_selector_controller_a053f47a303da4becb263bdb78f24965c}{SelectorController$<$ RobotController $\ast$ $>$}.

\hypertarget{class_robot_controller_a44fdc7736b45b3801bdd650c2e4487cc}{
\index{RobotController@{RobotController}!HandleAddedToRobot@{HandleAddedToRobot}}
\index{HandleAddedToRobot@{HandleAddedToRobot}!RobotController@{RobotController}}
\subsubsection[{HandleAddedToRobot}]{\setlength{\rightskip}{0pt plus 5cm}void RobotController::HandleAddedToRobot (
\begin{DoxyParamCaption}
\item[{{\bf SystematicRobot} \&}]{robot}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}protected, virtual\mbox{]}}}}
\label{class_robot_controller_a44fdc7736b45b3801bdd650c2e4487cc}
This function should be overridden to handle the event when the controller is added to the \hyperlink{class_systematic_robot}{SystematicRobot}. \hypertarget{class_robot_controller_a0b1874a782c9500768cb5e740ed57b6e}{
\index{RobotController@{RobotController}!HandleContinuous@{HandleContinuous}}
\index{HandleContinuous@{HandleContinuous}!RobotController@{RobotController}}
\subsubsection[{HandleContinuous}]{\setlength{\rightskip}{0pt plus 5cm}void RobotController::HandleContinuous (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}protected, virtual\mbox{]}}}}
\label{class_robot_controller_a0b1874a782c9500768cb5e740ed57b6e}
This function should be overridden to handle the continuous controller tasks. It will be called as often as possible when this controller is active. 

Reimplemented in \hyperlink{class_state_a8fd757a8c9b92a4387c37657644498cf}{State}, and \hyperlink{class_state_machine_controller_aaecedb0aa69ce601951574626796dafe}{StateMachineController}.

\hypertarget{class_robot_controller_aabb392f33363102fb82005e373450bc7}{
\index{RobotController@{RobotController}!HandleDeactivate@{HandleDeactivate}}
\index{HandleDeactivate@{HandleDeactivate}!RobotController@{RobotController}}
\subsubsection[{HandleDeactivate}]{\setlength{\rightskip}{0pt plus 5cm}void RobotController::HandleDeactivate (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}protected, virtual\mbox{]}}}}
\label{class_robot_controller_aabb392f33363102fb82005e373450bc7}
This function should be overridden to deactivate the controller. 

Reimplemented in \hyperlink{class_compound_controller_a6d99db5e0948e1f195e459ff2d07e19f}{CompoundController}, \hyperlink{class_p_s3_drive_controller_ab3ff2fc071ece947cb8af95d60fc8eaa}{PS3DriveController$<$ Drive, Value, Fetcher, Handler $>$}, \hyperlink{class_selector_controller_acdcce842fdcb5b2d0e2cc234de3d2772}{SelectorController$<$ Item $>$}, \hyperlink{class_state_a877215e69abc4eaf66fdc0ae25296e6a}{State}, \hyperlink{class_xbox_drive_controller_aad59582a314b34540be2f0e56e9907f9}{XboxDriveController$<$ Drive, Value, Fetcher, Handler $>$}, and \hyperlink{class_selector_controller_acdcce842fdcb5b2d0e2cc234de3d2772}{SelectorController$<$ RobotController $\ast$ $>$}.

\hypertarget{class_robot_controller_af4db95564f7fd78241be8baff2296e26}{
\index{RobotController@{RobotController}!HandlePeriodic@{HandlePeriodic}}
\index{HandlePeriodic@{HandlePeriodic}!RobotController@{RobotController}}
\subsubsection[{HandlePeriodic}]{\setlength{\rightskip}{0pt plus 5cm}void RobotController::HandlePeriodic (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}protected, virtual\mbox{]}}}}
\label{class_robot_controller_af4db95564f7fd78241be8baff2296e26}
This function should be overridden to handle the periodic controller tasks. It will be called periodically when the this controller is active. 

Reimplemented in \hyperlink{class_async_result_finish_state_a9c327aa447e197c8f6e3b50150d46162}{AsyncResultFinishState$<$ Result $>$}, \hyperlink{class_async_status_finish_state_a21f727ef7e4c1e5f284febf8f649f19a}{AsyncStatusFinishState}, \hyperlink{class_p_s3_drive_controller_a08c9b0fbf2ae0c3f9d4eaa0654d2a4be}{PS3DriveController$<$ Drive, Value, Fetcher, Handler $>$}, \hyperlink{class_selector_controller_a9e49fc8782d4ff0437e323125ebaae02}{SelectorController$<$ Item $>$}, \hyperlink{class_state_a29e67195da90c4c44e0e8f0fbe938c7c}{State}, \hyperlink{class_state_machine_controller_a47c7715d30ad34f9e2b523bb79de532e}{StateMachineController}, \hyperlink{class_time_wait_state_a67589e93acff3c395470f3fb4ad43e57}{TimeWaitState}, \hyperlink{class_two_joystick_drive_controller_af74d636f2c6a7306c3460c7a980feda2}{TwoJoystickDriveController$<$ Drive, Value, Fetcher, Handler $>$}, \hyperlink{class_xbox_drive_controller_a994ea55b33a4306d71c786f1840c158c}{XboxDriveController$<$ Drive, Value, Fetcher, Handler $>$}, and \hyperlink{class_selector_controller_a9e49fc8782d4ff0437e323125ebaae02}{SelectorController$<$ RobotController $\ast$ $>$}.

\hypertarget{class_robot_controller_a257ad879c96bf010624c25c91d209b11}{
\index{RobotController@{RobotController}!RequireControl@{RequireControl}}
\index{RequireControl@{RequireControl}!RobotController@{RobotController}}
\subsubsection[{RequireControl}]{\setlength{\rightskip}{0pt plus 5cm}template$<$typename T $>$ T\& RobotController::RequireControl (
\begin{DoxyParamCaption}
\item[{T \&}]{obj}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, protected\mbox{]}}}}
\label{class_robot_controller_a257ad879c96bf010624c25c91d209b11}
Add required control lock on an object (such as a \hyperlink{class_robot_subsystem}{RobotSubsystem}).

The lock is only acquired when the controller is activated. This prevents two unrelated controllers from using the same object at the same time. For more information on using locking, see our Thread Safety Manuel that does not exist yet. :P


\begin{DoxyParams}{Parameters}
{\em obj} & The object to be locked.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
The obj parameter. 
\end{DoxyReturn}


The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
C:/Documents and Settings/Sam/My Documents/My Projects/Entech-\/Fpk/Entech-\/Fpk/RobotController.hpp\item 
C:/Documents and Settings/Sam/My Documents/My Projects/Entech-\/Fpk/Entech-\/Fpk/RobotController.cpp\end{DoxyCompactItemize}
